package com.frejoys.common.dto.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;


@Data
public class PageDto {

    @Schema(type = "Integer", name = "page", description = "页数", required = true, defaultValue = "1")
    private Integer page;

    public Integer getPage() {
        return page == null ? 1 : page;
    }

    @Schema(type = "Integer", name = "size", description = "页数数量", required = true, defaultValue = "10")
    private Integer size;

    public Integer getSize() {
        return size == null ? 10 : size > 0 && size < 51 ? size : 20;
    }

}
